Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CheckboxGroup tests to use process.nextTick() #721

Closed
wants to merge 1 commit into from

Conversation

nimishjha
Copy link
Contributor

Fix CheckboxGroup tests to use process.nextTick() to ensure that state is updated.

Description

Motivation and Background Context

For some reason, the tests were passing on node v8, failing on node 6.14.2.

Does this PR introduce a breaking change?

  • Yes
  • No

How Has This Been Tested?

Screenshots (if appropriate):

Check-list:

  • I have read the Contributing document.
  • I've thought about and labelled my PR/commit message appropriately.
  • If this PR introduces breaking changes I've described the impact and migration path for existing applications.
  • CI is green (coverage, linting, tests).
  • I have updated the documentation accordingly.
  • I've two LGTMs/Approvals.
  • I've fixed or replied to all my code-review comments.
  • I've manually tested with a buddy.
  • I've squashed my commits into one.

expect(component.state().value).to.eql({ terminator: false, predator: true, soundofmusic: false });
process.nextTick(() => {
expect(component.state().value).to.eql({ terminator: false, predator: true, soundofmusic: false });
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to pass in done() to ensure that the test will finish after nextTick() is executed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good pickup man

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I do that, the test fails... go figure.

Copy link
Contributor

@mdotwills mdotwills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.

@@ -64,7 +65,9 @@ describe('CheckboxGroup', () => {
);
const firstChild = component.find('Checkbox').at(0);
firstChild.simulate('change', event);
expect(component.state().value).to.eql({ terminator: true, predator: false, soundofmusic: false });
process.nextTick(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is a good retro learned to add and talk about

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nimishjha
Copy link
Contributor Author

Closing this PR as none of us had any luck finding out what the problem was. It was decided to drop node v6 support instead, see #722.

@nimishjha nimishjha closed this May 28, 2018
@nimishjha nimishjha deleted the nj-fix-checkbox-tests branch May 28, 2018 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants